#pragma once
#include "subframe.h"

class QTcpServer;
class QTreeWidgetItem;
class QTreeWidget;
class QMenu;

class DialogContact;
class QDomElement;


class FormContact :
	public SubFrame
{
	Q_OBJECT
public:
	FormContact(QWidget * parent = 0,	Qt::WFlags f = 0);
	virtual void fileNew(void);
public:
	~FormContact(void);
	QTcpServer* tcpServer;
private:
	QTreeWidget *m_treeWidget;
	QMenu		*m_menuPop;
	static const	QString m_strRoot;
	QString			m_strCurIndex;
private slots:
	void itemDbClicked(QTreeWidgetItem* item, int column);
	void itemClicked(QTreeWidgetItem* item, int column);
	void showTreeMenu(const QPoint & pos);
	void createContact(void);
	void saveContact(void);
	void deleteContact(void);

public:
	void refresh(void);
	int showContact(const QString& index,DialogContact& dlg);
	int saveContact(const QString& index, DialogContact& dlg);
	int createContact(const QString& index, DialogContact& dlg);
	int saveDom(QDomElement& elem, DialogContact& dlg);
public:
	void deleteContact(QString& index);
	virtual void active();
};
